import axios from '~/plugins/axios'

const area = {
  state: {
    // 省列表
    provs: [],

    // 交货地
    trade: [],

    // 港口
    ports: {},

    // 省对应的城市列表
    citys: {}
  },

  mutations: {
    //  设置省列表
    SET_PROV (state, payload) {
      state.provs = payload
    },

    //  设置省份对应的城市列表
    SET_CITYS (state, payload) {
      state.citys[payload.provId] = payload.data
    },

    //  设置交货地
    SET_TRADEAREA (state, payload) {
      state.trade = payload
    },

    //  设置港口
    SET_PORT (state, payload) {
      state.ports[payload.tradeId] = payload.data
    }
  }
}

export default area
